package com.devicestatus.scheduler;

import com.devicestatus.service.GizwitsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;

/**
 * @author MeowParse
 * @date 2017/8/14.
 */
@Component
public class Scheduler {
	private final Logger logger = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private GizwitsService gizwitsService;
	//每隔10min执行一次
	@Scheduled(cron="0 0/10 05-23 * * ? ")
	public void getDeviceStatus1() {
		logger.info("每隔10min执行1次" );
		gizwitsService.getDeviceStatus();
	}

	@Scheduled(cron="0 0/30 00-05 * * ? ")
	public void getDeviceStatus2() {
		logger.info("每隔30min执行1次" );
		gizwitsService.getDeviceStatus();
	}
}
